import { Controller, Get, Post,Param, Body, Patch } from '@nestjs/common';
import { LuckService } from './luck.service';
import {Lucky} from '../entity'

@Controller('luck')
export class LuckController {
  constructor(private readonly luckService: LuckService) {}

  @Get('/:luckId')
  async findOne(@Param('luckId') id): Promise<{}> {
    return await this.luckService.findOne(id);
  }

  @Post('/:luckId/draw')
  async createDraw(@Param('luckId') luckId,@Body() body:Lucky): Promise<{}>{
    return await this.luckService.createDraw(luckId,body);
  }

  //设置获奖userid
  @Patch('/:luckId')
  async updateDraw(@Param('luckId') luckId,@Body() body:Lucky): Promise<{}>{
    return await this.luckService.updateLuck(luckId,body);
  }
}
